package com.example.demo.repository;

import com.example.demo.domain.UserGroup;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * 用户组管理Repository
 * @Author zmf
 * @Date 2018/12/12  17:33
 */
@Repository
public interface UserGroupRepository extends JpaRepository<UserGroup, Long> {
    @Modifying
    @Query("update UserGroup set fullGroupId =:fullGroupId where groupId =:groupId")
    void  updateFullGroupId(@Param(value = "fullGroupId") String fullGroupId,
                            @Param(value = "groupId") Long groupId);

    @Modifying
    @Query("update UserGroup set groupFullName =:groupFullName where groupId =:groupId")
    void  updateGroupFullName(@Param(value = "groupFullName") String groupFullName,
                            @Param(value = "groupId") Long groupId);
}
